/**
 * class  LinkButton
 * 自定义文本连接,不够完善
 * author haicent
 * email haicent@126.com
 * version 0.01
 */
package as3.component.controls
{
	import flash.events.MouseEvent;
	
	
	public class LinkButton extends Button
	{
		
		protected var _underLine:Boolean = false;
		
		public function LinkButton(labelValue:String="LinkButton")
		{
			super(labelValue);
			simpleButton.useHandCursor = true;
		}
		
		override protected function initCom():void
		{
			_minWidth = 0;
			_leftPadding = 6;
			_rightPadding = 6;
			super.initCom();
		}
		
		override protected function initUI():void
		{
			super.initUI();
			_uiLibrary["upImage"] = "LinkButton_upSkin";
			_uiLibrary["overImage"] = "LinkButton_overSkin";
			_uiLibrary["downImage"] = "LinkButton_downSkin";
			_uiLibrary["disabledImage"] = "LinkButton_disabledSkin";
			_upTextColor = _defaultSkin.linkBtnCssTable.upTextColor || 0x000000;
			_overTextColor = _defaultSkin.linkBtnCssTable.overTextColor || 0x000000;
			_downTextColor = _defaultSkin.linkBtnCssTable.downTextColor || 0x000000;
			_enableTextColor = _defaultSkin.linkBtnCssTable.enableTextColor || 0x666666;
			_underLine =  _defaultSkin.linkBtnCssTable.underLine || _underLine ;
			_fontBold = _defaultSkin.linkBtnCssTable.fontBold || false;
			_fontSize = _defaultSkin.linkBtnCssTable.fontSize || 12;
		}
		
		override protected function creatUI():void
		{
			super.creatUI();
			setUnderLine(_underLine);
		}
		
		override public function set enabled(value:Boolean):void
		{
			super.enabled = value;
			setUnderLine(_underLine);
		}
		
		public function set underLine(value:Boolean):void
		{
			if (_underLine == value) return;
			_underLine = value;
			setUnderLine(_underLine);
		}
		
		public function get underLine():Boolean
		{
			return _underLine;
		}
		
		private function setUnderLine(value:Boolean):void
		{
			if (_underLine) textField.underLine = true;
		}
		
		public function get upTextColor():uint
		{
			return _upTextColor;
		}
		
		public function set upTextColor(value:uint):void
		{
			_upTextColor = value;
		}
		public function set overTextColor(value:uint):void
		{
			_overTextColor = value;
		}
		public function set downTextColor(value:uint):void
		{
			_downTextColor = value;
		}
		public function set enableTextColor(value:uint):void
		{
			_enableTextColor = value;
		}
		
		override public function updateDisplay():void
		{
			super.updateDisplay();
			_textField.color = _upTextColor;
		}
	}
}